use clap::{Arg, Command};

#[test]
fn test_try_get_matches() {
    let cmd = Command::new("mycmd")
        .arg(
            Arg::new("flag")
                .long("flag")
                .action(clap::ArgAction::SetTrue)
        );

    let matches = cmd.clone().try_get_matches_from(["mycmd", "--flag"]).unwrap();
    assert!(matches.contains_id("flag"));
    // assert_eq!(
    //     matches.get_one::<usize>("flag").copied(),
    //     Some(10)
    // );
    //
    let matches = cmd.try_get_matches_from(["mycmd"]).unwrap();
    assert!(matches.contains_id("flag"));
    // assert_eq!(matches.get_one::<usize>("flag").copied(), Some(5)
    // );
}

#[test]
fn test_get_match_from(){
    let arg_vec = vec!["my_prog", "some", "args", "to", "parse"];

    let matches = Command::new("myprog")
        // Args and options go here...
        .get_matches_from(arg_vec);


    println!("{:?}", matches.value_source("args"))

    // assert_eq!(matches.get_one("args").unwrap(), "some args to parse");

    // assert_eq!(matches.value_of("args").unwrap(), "some args to parse");
}